; If you meet compile error, try 'sudo apt install gcc-multilib g++-multilib' first

%include "head.include"
; you code here

your_if:
; put your implementation here
mov eax,[a1]	; store value

cmp eax,12 ; a1 < 12
jl less12
cmp eax,24 ;a1 < 24 
jl less24
shl eax,4
jmp if_end

less24:
mov ecx,eax
neg ecx
add ecx,24
imul eax,ecx
jmp if_end

less12:
shr eax,1
inc eax

if_end:
mov [if_flag],eax

your_while:
; put your implementation here
mov ebx,[a2]

while:
cmp ebx,12
jl while_end

call my_random
mov ecx,[while_flag] ;while_flag是一个地址，存储字符数组地址的地址，不能做直接对地址操作
mov [ecx+ebx-12],al  ;eax 32,al 8,char 8(byte)
dec ebx
mov [a2],ebx	; 更新a2， my_random 有用
jmp while

while_end:

%include "end.include"

your_function:
; put your implementation here
pushad
mov ebx,[your_string]

print:
mov eax,[ebx]
cmp al,0   ; al -->char, not eax
je print_end

;pushad	  ;可不选

push eax
call print_a_char
pop eax

;add esp,4  ; 调整栈指针，弹出字符参数,上下两行均可
;popad

inc ebx
jmp print

print_end:
popad
ret
